<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>收入规则列表-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .background {
            background: #f5f5f5;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">收入规则列表</div>
		<div class="right">
			<if condition="get_permission('CRMI-R',NULL,9)">
				<a href="javascript:;" class="btn btn-add ml5 add_cus" now="{$rate}" nowdate="{$nowdate}">调整税率</a>
			</if>
		</div>
    </div>
    <div id="content">
        <div class="table-scrollx">
            <table class="table table-bordered">
                <tr class="table-header fixed-table-header">
                    <td width="150">
                        <select name="project_id" class="form-control w400">
                            <option value="" <if condition="$project_id eq null">selected</if>>关联项目</option>
                            <foreach name="crm_project_array" item="vo">
                                <option value="{$vo['project_id']}"<if condition="$project_id eq $vo['project_id']">selected</if>>
								{$vo['project_num']}-{$vo['name']}</option>
                            </foreach>
                        </select>
                    </td>
					<td width="100">项目状态</td>
                    <td width="100">合同编号</td>
                    <td width="180">服务期限</td>
                    <td width="50">合同有效时间</td>
                    <td width="50">
						<select name="base" class="form-control w100">
							<option value="" <if condition="$check_base_id eq null">selected</if>>基础管理收入分摊方式</option>
                            <foreach name="apportion_type" item="vo">
                                <option value="{$vo['id']}"<if condition="$check_base_id eq $vo['id']">selected</if>>
								{$vo['name']}</option>
                            </foreach>
						</select>
					</td>
                    <td width="50">
						<select name="float" class="form-control w100">
							<option value="" <if condition="$check_float_id eq null">selected</if>>浮动收入分摊方式</option>
                            <foreach name="apportion_type" item="vo">
                                <option value="{$vo['id']}"<if condition="$check_float_id eq $vo['id']">selected</if>>
								{$vo['name']}</option>
                            </foreach>
						</select>
					</td>
                    <td width="">操作</td>
                    </if>
                </tr>
                <if condition="$result eq NULL">
                    <tr>
                        <td class="text-center" colspan="8">暂无相关内容</td>
                    </tr>
                </if>
                <foreach name="result" item="vo">
                    <tr>
                        <td>{$vo['project_num']}-{$vo['name']}</td>
                        <td>{:get_project_stage($vo['stage'])}</td>
                        <td title="{$vo['file_name']}">
							{$vo['number']|default=""}<if condition="$vo['file_url'] neq ''">
							<a href="{$vo['file_url']}" target="_blank" data-toggle="tooltip" data-placement="right" title="{$vo['file_name']}" class="ml5"><i class="glyphicon glyphicon-download-alt mr5"></i></a>
							</if>
						</td>
                        <td>{$vo['sign_start_date']}~{$vo['sign_end_date']}</td>
                        <td>{$vo['serve_mouth']}</td>
                        <td>
							<if condition="$vo['income_base'] neq ''">
								<a href="javascript:;" pname="{$vo['project_num']}-{$vo['name']}" rid="{$vo['base_rule_id']}" class="base_detail">{:getIncomeType($vo['base_rule_id'],1)}</a>
							<else/>
							<a href="javascript:;" pname="{$vo['project_num']}-{$vo['name']}" rate_type="1" rid="{$rate_id}" now="{$rate}" pid="{$vo['project_id']}" data-toggle="tooltip" data-placement="left" title="" class="mr5 add_base"
                                   data-original-title="设置规则"><i class="glyphicon glyphicon-edit"></i></a>
							</if>
						</td>
                        <td>
							<if condition="$vo['income_float'] neq ''">
								<a href="javascript:;" pname="{$vo['project_num']}-{$vo['name']}" rid="{$vo['float_rule_id']}" class="float_detail">{:getIncomeType($vo['float_rule_id'],1)}</a>
							<else/>
							<a href="javascript:;" pname="{$vo['project_num']}-{$vo['name']}" rate_type="2" rid="{$rate_id}" now="{$rate}" pid="{$vo['project_id']}" data-toggle="tooltip" data-placement="left" title="" class="mr5 add_float"
                                   data-original-title="设置规则"><i class="glyphicon glyphicon-edit"></i></a>
							</if>
						</td>
                        <td class="nowrap">
							<if condition="$vo['payment'] neq ''">
								补差:{$vo['payment_date']}
							<else/>
								<a href="javascript:;" pname="{$vo['project_num']}-{$vo['name']}" pid="{$vo['project_id']}" class="payment" data-toggle="tooltip" data-placement="left"
                               title="">补差设置</a>
							</if>
                        </td>
                    </tr>
                </foreach>
                </if>
            </table>
        </div>
    </div>
</div>
<include file="Crm:income_ajax_rule"/>
<include file="Include:javascript"/>
<script>
    $(function () {
        $(document).on("change", "[name='project_id']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/Crm/income_rule_list/project_id/" + val;
        });
		$(document).on("change", "[name='float']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/Crm/income_rule_list/check_float_id/" + val;
        });
		$(document).on("change", "[name='base']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/Crm/income_rule_list/check_base_id/" + val;
        });
        //删除
        $(".delete").ajaxModal({
            "title_text": "确认提示框",
            "body_text": "您确定要删除吗？",
            "url": "__APP__/Contract/del/id/",
            "data": {"id": "id"}
        });
    })
</script>
<include file="Crm:javascript_income"/>
</body>
</html>